home *** CD-ROM | disk | FTP | other *** search
- /************************ Time Out Routines ***********************/
- /* Include "Timer" Files */
- #ifdef WINNT
- #include <windows.h>
- #else
- #ifdef VMS
- #include <time.h>
- #else
-
- #ifdef APOLLO
- #include <time.h>
- #include "base.h"
- #include "cal.h"
- #else
- #include <sys/time.h>
- #endif /* APOLLO */
-
- #endif /* VMS */
-
- #endif /* WINNT */
-
- LOCAL LONG cur_time_in_sec;
- #define NUM_SECS_TO_STOP 10
-
- /*-----------------------------------------------------------------*/
- LOCAL VOID
- InitTimer()
- {
- #ifdef WINNT
-
- DWORD time;
- time = GetTickCount(); /* returns num milliseconds since windows started */
- cur_time_in_sec = (LONG)(time / 1000);
-
- #else
-
- #ifdef VMS
- INT time[2];
-
- SYS$GETTIM( time );
- cur_time_in_sec = time[0] / 10000000; /* 10,000,000 gives the seconds */
-
- #else
-
- #ifdef APOLLO
- time_$timeval_t tp;
-
- (VOID)gettimeofday( &tp, (struct timezone *)NULL );
- cur_time_in_sec = tp.sec;
-
- #else
-
- struct timeval tp;
-
- (VOID)gettimeofday( &tp, (struct timezone *)NULL );
- cur_time_in_sec = tp.tv_sec;
- #endif /* APOLLO */
-
- #endif /* VMS */
-
- #endif /* WINNT */
- }
-
- /*-----------------------------------------------------------------*/
- LOCAL BOOLPARAM
- TimedOut()
- {
- DV_BOOL timeout = NO;
- #ifdef WINNT
-
- INT time;
- time = GetTickCount() / 1000; /* returns num milliseconds since windows started */
-
- if ((time - cur_time_in_sec) >= NUM_SECS_TO_STOP )
- timeout = YES;
- #else
-
- #ifdef VMS
- INT time[2];
-
- SYS$GETTIM( time );
- if( ( ( time[0]/10000000 ) - cur_time_in_sec ) >= NUM_SECS_TO_STOP )
- timeout = YES;
-
- #else
-
- #ifdef APOLLO
- time_$timeval_t tp;
-
- (VOID)gettimeofday( &tp, (struct timezone *)NULL );
-
- if ((tp.sec - cur_time_in_sec) >= NUM_SECS_TO_STOP )
- timeout = YES;
- #else
-
- struct timeval tp;
-
- (VOID)gettimeofday( &tp, (struct timezone *)NULL );
-
- if ((tp.tv_sec - cur_time_in_sec) >= NUM_SECS_TO_STOP )
- timeout = YES;
-
- #endif /* APOLLO */
-
- #endif /* VMS */
-
- #endif /* WINNT */
-
- return timeout;
- }
-
-